package com.hzncc.flowable_diboot.contract.vo;

import com.diboot.core.binding.annotation.BindDict;
import com.diboot.core.binding.annotation.BindEntityList;
import com.diboot.core.binding.annotation.BindField;
import com.diboot.core.binding.annotation.BindFieldList;
import com.diboot.core.vo.FileVO;
import com.diboot.core.vo.LabelValue;
import com.diboot.file.entity.FileRecord;
import com.diboot.iam.entity.IamUser;
import com.diboot.tenant.entity.IamTenant;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.hzncc.flowable_diboot.contract.entity.ContractAudit;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.util.List;
/**
* 合同审批 VO定义
* @author MyName
* @version 1.0
* @date 2024-09-18
* Copyright © MyCorp
*/
@Getter @Setter @Accessors(chain = true)
public class ContractAuditListVO extends ContractAudit  {
private static final long serialVersionUID = 1346940791957570691L;
    /**
    * 合同类型 关联字典选项
    */
    @BindDict(
    type = "contractType",
    field = "contractType"
    )
    private LabelValue contractTypeLabel;

    /**
    * 产品类型 关联字典选项
    */
    @BindDict(
    type = "contractProductType",
    field = "productType"
    )
    private LabelValue productTypeLabel;

    /**
    * 部门审批 关联字典选项
    */
    @BindDict(
    type = "contractDeptAudit",
    field = "deptAudit"
    )
    private LabelValue deptAuditLabel;

    /**
    * 客户性质 关联字典选项
    */
    @BindDict(
    type = "customerType",
    field = "customerType"
    )
    private LabelValue customerTypeLabel;

    /**
    * OA状态 关联字典选项
    */
    @BindDict(
    type = "OaStatus",
    field = "oaStatus"
    )
    private LabelValue oaStatusLabel;

    /**
    * SAP状态 关联字典选项
    */
    @BindDict(
    type = "SapStatus",
    field = "sapStatus"
    )
    private LabelValue sapStatusLabel;

    /**
    * 业务板块 关联字典选项
    */
    @BindDict(
    type = "contractBusinessModel",
    field = "businessModel"
    )
    private LabelValue businessModelLabel;

    @BindFieldList(
        entity = IamUser.class,
        field = "id",
        condition = "this.id = mdl_contract_audit_iam_user.contract_audit and mdl_contract_audit_iam_user.`user` = id"
    )
    private List<String> starUids;

    /**
    * 关注人 关联信息
    */
    @BindFieldList(
        entity = IamUser.class,
        field = "userNum",
        condition = "this.id = mdl_contract_audit_iam_user.contract_audit and mdl_contract_audit_iam_user.`user` = id"
     )
    private List<String> starUidsLabel;

    /**
    * 创建人 关联信息
    */

    @BindField(
        entity = IamUser.class,
        field = "realname",
        condition = "this.create_by = id"
     )
    private String createByLabel;

    /**
    * 更新人 关联信息
    */

    @BindField(
        entity = IamUser.class,
        field = "realname",
        condition = "this.update_by = id"
     )
    private String updateByLabel;

    @BindField(
            entity = IamUser.class,
            field = "realname",
            condition = "this.saler = id"
    )
    private String salerName;

    @BindField(
            entity = IamUser.class,
            field = "realname",
            condition = "this.header = id"
    )
    private String headerName;

    @BindField(
            entity = IamUser.class,
            field = "realname",
            condition = "this.signer = id"
    )
    private String signerName;

    @BindField(
            entity = IamTenant.class,
            field = "name",
            condition = "this.signDept = id"
    )
    private String signDeptName;

    /**
     * 结算方式
     */
    @BindDict(
            type = "paymentMethod",
            field = "settlementMethod"
    )
    private LabelValue settlementMethodLabel;

    /**
     * 交货期
     */
    @BindDict(
            type = "deliveryTimeOfTheSalesContract",
            field = "deliveryDate"
    )
    private LabelValue deliveryDateLabel;

    @BindDict(
            type = "contractStatus",
            field = "contractStatus"
    )
    private LabelValue contractStatusLabel;

    @BindEntityList(
            entity = FileRecord.class,
            condition = "this.auditAttachment = id",
            splitBy = ","
    )
    private List<FileVO> auditAttachmentFiles;

    @BindEntityList(
            entity = FileRecord.class,
            condition = "this.technicalRequirementsAttachment = id",
            splitBy = ","
    )
    private List<FileVO> technicalRequirementsAttachmentFiles;

    @BindDict(
            type = "productLineType",
            field = "productLineType"
    )
    private LabelValue productLineTypeLabel;

    @BindDict(
            type = "paymentMethod",
            field = "paymentMethod"
    )
    private LabelValue paymentMethodLabel;
}